/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.subway.persistencias;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Héctor <UFG>
 */
@Entity
@Table(name = "medio_pago", catalog = "bd_subway", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MedioPago.findAll", query = "SELECT m FROM MedioPago m"),
    @NamedQuery(name = "MedioPago.findByMedioId", query = "SELECT m FROM MedioPago m WHERE m.medioId = :medioId"),
    @NamedQuery(name = "MedioPago.findByMedioNombre", query = "SELECT m FROM MedioPago m WHERE m.medioNombre = :medioNombre"),
    @NamedQuery(name = "MedioPago.findByMedioDescripcion", query = "SELECT m FROM MedioPago m WHERE m.medioDescripcion = :medioDescripcion")})
public class MedioPago implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "medioId")
    private Integer medioId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "medioNombre", nullable = false, length = 40)
    private String medioNombre;
    @Size(max = 40)
    @Column(name = "medioDescripcion", length = 40)
    private String medioDescripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pedMedPagoId")
    private List<Pedido> pedidoList;

    public MedioPago() {
    }

    public MedioPago(Integer medioId) {
        this.medioId = medioId;
    }

    public MedioPago(Integer medioId, String medioNombre) {
        this.medioId = medioId;
        this.medioNombre = medioNombre;
    }

    public Integer getMedioId() {
        return medioId;
    }

    public void setMedioId(Integer medioId) {
        this.medioId = medioId;
    }

    public String getMedioNombre() {
        return medioNombre;
    }

    public void setMedioNombre(String medioNombre) {
        this.medioNombre = medioNombre;
    }

    public String getMedioDescripcion() {
        return medioDescripcion;
    }

    public void setMedioDescripcion(String medioDescripcion) {
        this.medioDescripcion = medioDescripcion;
    }

    @XmlTransient
    public List<Pedido> getPedidoList() {
        return pedidoList;
    }

    public void setPedidoList(List<Pedido> pedidoList) {
        this.pedidoList = pedidoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (medioId != null ? medioId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MedioPago)) {
            return false;
        }
        MedioPago other = (MedioPago) object;
        if ((this.medioId == null && other.medioId != null) || (this.medioId != null && !this.medioId.equals(other.medioId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.medioNombre;
    }
    
}
